﻿using LY.DataAccess.Repository;
using LY.Entity;
using LY.Entity.Entities;
using LY.Entity.PageSearch;
using LY.Entity.SearchEntity;
using LY.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.Business.ServiceImpl
{
    public class ClaimsService : IClaimsService
    {
        ClaimsRepository cRepository;
        public ClaimsService()
        {
            cRepository = new ClaimsRepository();
        }

        public List<T_Project_EX> GetProjects(int type, int num)
        {
            return cRepository.GetProjects(type, num);
        }


        public List<Entity.Entities.T_Investment_EX> GetHotInvestors(int? top)
        {
            return cRepository.GetHotInvestors(top);
        }


        public T_Project_EX GetProjectById(string id)
        {
            return cRepository.GetProjectById(id);
        }


        public List<T_Document_EX> GetDocImage(string pid)
        {
            return cRepository.GetDocImage(pid);
        }


        public decimal GetAmountsByPid(string pid)
        {
            return cRepository.GetAmountsByPid(pid);
        }

        public PagedList<T_Investment_EX> GetInvestors(PageView view, string pid)
        {
            return cRepository.GetInvestors(view, pid);
        }


        public PagedList<T_Project_EX> GetProjectOfMine(PageView view, string id, ClaimsSearch condition)
        {
            return cRepository.GetProjectOfMine(view, id, condition);
        }


        public int UpdateProject(string projectId, DateTime time, int status)
        {
            return cRepository.UpdateProject(projectId, time, status);
        }

        //根据投资编号获取合同信息
        public T_Contract GetContractByNumber(string number)
        {
            return cRepository.GetContractByNumber(number);
        }
        //添加合同
        public int SaveContract(T_Contract contract)
        {
            return (int)cRepository.Insert(contract);
        }


        public PagedList<T_Project_EX> GetProjects(PageView view, InvestListSearch condition)
        {
            return cRepository.GetProjects(view, condition);
        }


        public decimal GetInvestProfits(string mid)
        {
            return cRepository.GetInvestProfits(mid);
        }


        public int DeleteMyInvest(string id)
        {
            return cRepository.DeleteMyInvest(id);
        }

        public bool IsGreenHand(string mid)
        {
            return cRepository.IsGreenHand(mid);
        }


        public T_Project_EX GetProjects(string id)
        {
            return cRepository.GetProjects(id);
        }
    }
}
